USERNAME = 'user'
PASSWD = 'password'

num = 0

while num != 3:
    username = input('请输用户名：')
    passwd = input('请输入密码：')
    if username == USERNAME and passwd == PASSWD:
        print('登录成功')
        break
    else:
        print('用户名或密码错误！！！')
        num += 1
        if num == 3:
            print('失败三次，程序退出中......')
